//
//  UserModel.m
//  EZ Tracker
//
//  Created by FENGYL on 2016/12/3.
//  Copyright © 2016年 FENGYL. All rights reserved.
//

#import "UserModel.h"

@implementation UserModel

singleton_implementation(UserModel)

-(NSMutableArray *)selectedDeviceSerialNumberArray{
    
    if (!_selectedDeviceSerialNumberArray) {
        
        _selectedDeviceSerialNumberArray = [NSMutableArray array];
        
    }
    
    return _selectedDeviceSerialNumberArray;
}

-(NSMutableArray *)deviceActivityIndicatorArray{
    
    if (!_deviceActivityIndicatorArray) {
        _deviceActivityIndicatorArray = [NSMutableArray array];
        
        
        
    }
    
    return _deviceActivityIndicatorArray;
    
}

-(NSMutableDictionary *)mainViewControllerAnnotationDictionary{
    
    if (!_mainViewControllerAnnotationDictionary) {
        
        _mainViewControllerAnnotationDictionary = [NSMutableDictionary dictionary];
        
    }
    
    return _mainViewControllerAnnotationDictionary;
    
}

-(NSMutableDictionary *)deviceIconDictionary{
    
    if (!_deviceIconDictionary) {
        
        NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
        
        NSString *filePath = [path stringByAppendingPathComponent:ARCHIVER_DEVICE_ICON_DICTIONARY];
        
        NSMutableDictionary * dict = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
        
        if (dict) {
            
            _deviceIconDictionary = dict;
            
        }else{
            
            _deviceIconDictionary = [NSMutableDictionary dictionary];
            
        }
        
    }
    
    return _deviceIconDictionary;
    
}

-(NSMutableDictionary *)msgPhoneNumberDictionary{
    
    if (!_msgPhoneNumberDictionary) {
        
        NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
        
        NSString *filePath = [path stringByAppendingPathComponent:ARCHIVER_MSG_PHONE_NUMBER_DICTIONARY];
        
        NSMutableDictionary * dict = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
        
        if (dict) {
            
            _msgPhoneNumberDictionary = dict;
            
        }else{
            
            _msgPhoneNumberDictionary = [NSMutableDictionary dictionary];
            
        }
        
    }
    return _msgPhoneNumberDictionary;
}

-(NSMutableDictionary *)changeDeviceNameDictionary{
    
    if (!_changeDeviceNameDictionary) {
        
        NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
        
        NSString *filePath = [path stringByAppendingPathComponent:ARCHIVER_CHANGE_DEVICE_NAME_DICTIONARY];
        
        NSMutableDictionary * dict = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
        
        if (dict) {
            
            _changeDeviceNameDictionary = dict;
            
        }else{
            
            _changeDeviceNameDictionary = [NSMutableDictionary dictionary];
            
        }
        
    }
    return _changeDeviceNameDictionary;
}

@end
